package com.ms.service.controller;

import com.ms.service.entity.Product;
import com.ms.service.service.ProductService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class ProductController {

    @Resource
    private ProductService productService;

    @RequestMapping(name = "getProducts",value="/getProducts", method = RequestMethod.GET)
    public List<Product> getProducts(){
        return productService.getProducts();
    }
    @RequestMapping(name = "getProduct",value="/getProduct/{id}", method = RequestMethod.GET)
    public Product getProduct(@PathVariable int id){
        return productService.getProduct(id);
    }
}
